# Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>
# Contributor: Stefan Tatschner <stefan@rumpelsepp.org>
# Contributor: Gökberk Yaltıraklı <aur at gkbrk dot com>
# Contributor: Drew DeVault <sir@cmpwn.com>

pkgname=aerc
pkgver=0.16.0
pkgrel=1
pkgdesc='Email Client for your Terminal'
arch=('loong64' 'x86_64')
url='https://git.sr.ht/~rjarry/aerc'
license=('MIT')
depends=('notmuch-runtime' 'gawk')
makedepends=('go' 'scdoc')
optdepends=('w3m: for showing HTML messages'
            'dante: for showing HTML messages')
provides=('aerc')
conflicts=('aerc')
source=("$pkgname-$pkgver.tar.gz::https://git.sr.ht/~rjarry/${pkgname}/archive/${pkgver}.tar.gz")
sha512sums=('8196424915f8f6dc80bad0f936e34b7f51298665af3579ae8c06699a4f1caf962258185a432909911920ec1eb089c9f178c9086c54c0e799a44e1e0dac907fd8')

build() {
    cd "$srcdir/$pkgname-$pkgver"
    export CGO_LDFLAGS="${LDFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"
    export GOFLAGS="-buildmode=pie -trimpath -modcacherw -tags=notmuch"
    make PREFIX=/usr LIBEXECDIR=/usr/lib/aerc
}

package() {
    cd "$srcdir/$pkgname-$pkgver"
    make PREFIX=/usr LIBEXECDIR=/usr/lib/aerc DESTDIR=$pkgdir install
    install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/aerc/"
}
